<template>
	<view class="cate">
		<scroll-view class="cate-list">
			<view class="item" v-for="(item,index) in cateOneList">
				{{item.name}}
			</view>
		</scroll-view>
		<scroll-view class="cate-goods"></scroll-view>
	</view>
</template>

<script setup>
import {ref} from 'vue'
import {onLoad} from '@dcloudio/uni-app'


onLoad(()=>{
	getCateOneList()
})

const cateOneList=ref([])
async function getCateOneList(){
	let res=await uni.$post('/categoryListLevel',{
		"level":1
	})
	if(code==200){
		cateOneList.value=result
		/**
		 *  js数组的添加删除操作
		 * arr.unshift() 添加首位
		 * arr.shift() 从首位删除
		 * arr.push() 添加到末尾
		 * arr.pop() 末尾删除
		 */
		cateOneList.value.unshift({id:0,name:"全部"})
	}
	console.log(cateOneList.value)
}
</script>

<style>
	.cate>.cate-list{
		width: 1800rpx;
		border: 1px solid red;
		background-color: #efefef;
		height: calc(100vh - 97px);
		/* #ifdef MP-WEIXIN */
		height: 100vh;
		/* #endif */	
	}
	.cate>.cate-list>.item{
		font-size: 19px;
		
	}
</style>
